import java.util.Scanner;

public class 螺旋折线 {
    static int x;
    static int y;
    static int sum;
    public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       int a = s.nextInt();
       int b = s.nextInt();
        line(a,b);
        System.out.println(sum);
    }
    private static void line(int a,int b) {
        int len = 1;
        while (true) {
            left(len);up(len);
            len++;
            if(y==b) break;
            right(len); down(len);
            len++;
        }
        int x1 = (x-a)*(x-a);int y1 = (y-b)*(y-b);
        sum+=Math.sqrt(x1+y1);
    }
    private static void left(int l) {
        x-=l;sum+=l;
    }
    private static void right(int l) {
        x+=l;sum+=l;
    }
    private static void up(int l) {
        y+=l;sum+=l;
    }
    private static void down(int l) {
        y-=l;sum+=l;
    }


}
